package com.rs.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zhouwz
 * @date 2020/7/16 13:12
 */
@AllArgsConstructor
public enum DeviceEvent {
    /**
     * 车辆动作
     */
    UP("UP", "举升"),
    DROP("DROP", "下落"),
    TURN("TURN", "转向"),
    PAUSE("PAUSE", "暂停"),
    OTHER("OTHER", "其他"),
    CHARGE("CHARGE", "充电"),
    FORWARD("FORWARD", "前进"),
    BACKWARD("BACKWARD", "后退"),
    CONTINUE("CONTINUE", "继续"),
    DETECTION("DETECTION", "探测"),
    STOP_CHARGE("STOP_CHARGE", "停止充电"),
    ;
    @Getter
    private final String msg;
    @Getter
    private final String info;

    public static DeviceEvent getDeviceEvent(String msg) {
        for (DeviceEvent item : DeviceEvent.values()) {
            if (item.getMsg().equals(msg)) {
                return item;
            }
        }
        return OTHER;
    }
}
